package com.qf.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qf.entiy.dto.Goods;
import com.qf.entiy.dto.GoodsSku;
import com.qf.mapper.GoodsMapper;
import com.qf.mapper.GoodsSkuMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class GoodsSkuService extends ServiceImpl<GoodsSkuMapper, GoodsSku> {
   //根据goodID删除goodsSku
    @Transactional
    public void removeByGoodsId(Long id) {
        QueryWrapper<GoodsSku> wrapper = new QueryWrapper<>();
        wrapper.lambda().eq(GoodsSku::getGoodId,id);
        this.remove(wrapper);
    }
    @Transactional(readOnly = true)
    public Object getSkuListByGoodsId(Long id) {
        QueryWrapper<GoodsSku> wrapper = new QueryWrapper<>();
        wrapper.lambda().eq(GoodsSku::getGoodId,id);
        return this.list(wrapper);
    }
}
